package com.wiboson.money.Tool;

import com.wiboson.money.DataSource.historySource;
import com.wiboson.money.DataSource.model.KLine;

import java.util.List;

/**
 * Created by moon on 17/4/29.
 */
public class AveragePrice {
    public static void main(String args[]){
        System.out.println(averagePrice('1',600106));
    }
    public static double averagePrice(char type,int num){
        List<KLine> lines = historySource.getHistory(type,num);
        int i = 0;
        double price = 0;
        for(;i<lines.size();i++){
            price+=lines.get(i).getEndPrice();
        }
        return (price/i);
    }
}
